home *** CD-ROM | disk | FTP | other *** search
/ System Booster / System Booster.iso / Archives / ARexxTools / Mindrx.lha / AudInPut21APR94A next >
Encoding:
Text File  |  1999-12-31  |  3.4 KB  |  65 lines

  1. /*  AudInPut21APR94A - auditory input via Clip List for Mind.rexx AI.     */
  2. ht = 1             /*  1APR1994:  A "heeltap" variable during handshake.  */
  3. LF = 'A'x
  4. quitline = "To terminate Mind.rexx session, press <ESCAPE> key." 'A'x
  5. rd = 0      /*  2APR1994:  A counter to escape from waiting for "READY."  */
  6. revline = "To review auditory memory, press <BACK SPACE> key." 'A'x
  7. thinkline = "To let Mind.rexx think, press <TAB> key."  'A'x
  8. CALL Open(raw_window,'RAW:0/0/640/70/',
  9. 'Enter natural language word, followed by a non-letter.  (<DEL> to quit.)')
  10. prelimline = "Synch =" GETCLIP('synch')"; control = "GETCLIP('control')";",
  11.   "response = "GETCLIP('response')"; message =" GETCLIP('message') 'A'x
  12. prelimput = CALL Writech(raw_window, prelimline)
  13.  
  14. DO FOREVER
  15.   rd = 0
  16.   DO WHILE GETCLIP('response') = "WAIT"
  17.     waitline = "AI response is set to " || GETCLIP('response') ||"."||'D'x
  18.     waitmess = CALL Writech(raw_window, waitline)
  19.     END
  20.   linefeed = CALL Writech(raw_window, LF)
  21.   /*  First AudInPut waits for a "READY" response from Mind.rexx.         */
  22.   audput = Readch(raw_window,1)
  23.   IF audput = '1B'x THEN SETCLIP('control', "QUIT")  /* Immediate "QUIT". */
  24.   DO UNTIL GETCLIP('response') = "READY"                  /*  13APR1994.  */
  25.     respline = "response = " || GETCLIP('response') || 'D'x
  26.     stall = CALL Writech(raw_window, respline)
  27.     IF GETCLIP('control') = "RESET" THEN EXIT  /*  13APR1994:  An escape. */
  28.     END                                                   /*  13APR1994.  */
  29.   IF GETCLIP('response') = "READY" THEN SETCLIP('message', audput)
  30.   banner = "Synch =" GETCLIP('synch')"; control = "GETCLIP('control')";",
  31.     "response = "GETCLIP('response')"; message =" GETCLIP('message') 'A'x
  32.   status = CALL Writech(raw_window, banner)
  33.   thinkopt = CALL Writech(raw_window, thinkline)           /*  4APR1994.  */
  34.   IF audput = '9'x THEN SETCLIP('control', "COGITATE")      /*  TAB key.  */
  35.   revopt = CALL Writech(raw_window, revline)
  36.   IF audput = '8'x THEN SETCLIP('control', "REVIEW")
  37.   quitopt = CALL Writech(raw_window, quitline)
  38.   IF audput = '1B'x THEN SETCLIP('control', "QUIT")      /*  ESC = QUIT.  */
  39.   IF audput = '1B'x THEN audput = ""  /*  Reset to nothing after "QUIT".  */
  40.   IF audput = '7F'x THEN EXIT                     /*  Hit "DEL" to exit.  */
  41.   IF audput < '41'x THEN audmem.t = '20'x
  42.   IF audput > '7A'x THEN audmem.t = '20'x
  43.   inchar = audmem.t
  44.   LF = 'A'x
  45.   feedline = CALL Writech(raw_window, LF)
  46.   DO UNTIL GETCLIP('response') = "WAIT"
  47.     /*  AudInPut waits to be told to wait by Mind.rexx.  */
  48. heeltap = "Character" audput "sent;" GETCLIP('response') ht "cycle(s)." 'D'x
  49.     tapping = CALL Writech(raw_window, heeltap)
  50.     ht = ht + 1
  51.     IF ht = 1000 THEN LEAVE  /*  Safety measure.  */
  52.     END
  53.   ht = 1  /*  Reset ht to this minimal value.  */
  54.   feedline = CALL Writech(raw_window, LF)
  55.   audput = ""  /*  2APR1994:  A reset for safety.  */
  56. END
  57. /*  The Clip List has four items in it:                                   */
  58. /*        -  control (commands to be issued to Mind.rexx);                */
  59. /*        -  synch  (timing to be set by either Mind.rexx or AudInPut);   */
  60. /*        -  message (passed from AudInPut to Mind.rexx);                 */
  61. /*        -  response ( WAIT/READY from Mind.rexx to AudInPut).           */
  62. /*     Mind.rexx tends to slow down as its memory gets filled, so we      */
  63. /*  assume that the AudInPut program should use a "DO UNTIL" loop to      */
  64. /*  wait for Mind.rexx to send a "READY" response via the Clip List.      */
  65.